<%
Public Function HtmlSafe(html)
  Dim i
  Dim strbld
  Dim coder
  If IsNull(html) Then 
    coder="" 
    Exit Function
  End If
  For i = 1 To Len(html)
    Select Case Mid(html, i, 1)
      Case "<"       
        coder = coder & "&lt;"
      Case ">"
        coder = coder & "&gt;"     
      Case "&"
        coder = coder & "&amp;"
      Case """"
        coder = coder & "&quot;"
      Case chr(9)
        coder = coder & "&nbsp;&nbsp;"
      Case chr(32)
        coder = coder & "&nbsp;"
      Case chr(39)
        coder = coder & "&#39;"
      Case "Α"
        coder = coder & "&Alpha;"
      Case "Β"
        coder = coder & "&Beta;"
      Case "Γ"
        coder = coder & "&Gamma;"
      Case "Δ"
        coder = coder & "&Delta;"
      Case "Ε"
        coder = coder & "&Epsilon;"
      Case "Ζ"
        coder = coder & "&Zeta;"
      Case "Η"
        coder = coder & "&Eta;"
      Case "Θ"
        coder = coder & "&Theta;"
      Case "Ι"
        coder = coder & "&Iota;"
      Case "Κ"
        coder = coder & "&Kappa;"
      Case "Λ"
        coder = coder & "&Lambda;"
      Case "Μ"
        coder = coder & "&Mu;"
      Case "Ν"
        coder = coder & "&Nu;"
      Case "Ξ"
        coder = coder & "&Xi;"
      Case "Ο"
        coder = coder & "&Omicron;"
      Case "Π"
        coder = coder & "&Pi;"
      Case "Ρ"
        coder = coder & "&Rho;"
      Case "Σ"
        coder = coder & "&Sigma;"
      Case "Τ"
        coder = coder & "&Tau;"
      Case "Υ"
        coder = coder & "&Upsilon;"
      Case "Φ"
        coder = coder & "&Phi;"
      Case "Χ"
        coder = coder & "&Chi;"
      Case "Ψ"
        coder = coder & "&Psi;"
      Case "Ω"
        coder = coder & "&Omega;"
      Case "α"
        coder = coder & "&alpha;"
      Case "β"
        coder = coder & "&beta;"
      Case "γ"
        coder = coder & "&gamma;"
      Case "δ"
        coder = coder & "&delta;"
      Case "ε"
        coder = coder & "&epsilon;"
      Case "ζ"
        coder = coder & "&zeta;"
      Case "η"
        coder = coder & "&eta;"
      Case "θ"
        coder = coder & "&theta;"
      Case "ι"
        coder = coder & "&iota;"
      Case "κ"
        coder = coder & "&kappa;"
      Case "λ"
        coder = coder & "&lambda;"
      Case "μ"
        coder = coder & "&mu;"
      Case "ν"
        coder = coder & "&nu;"
      Case "ξ"
        coder = coder & "&xi;"
      Case "ο"
        coder = coder & "&omicron;"
      Case "π"
        coder = coder & "&pi;"
      Case "ρ"
        coder = coder & "&rho;"
      Case "ς"
        coder = coder & "&sigmaf;"
      Case "σ"
        coder = coder & "&sigma;"
      Case "τ"
        coder = coder & "&tau;"
      Case "υ"
        coder = coder & "&upsilon;"
      Case "φ"
        coder = coder & "&phi;"
      Case "χ"
        coder = coder & "&chi;"
      Case "ψ"
        coder = coder & "&psi;"
      Case "ω"
        coder = coder & "&omega;"
      Case "ϑ"
        coder = coder & "&thetasym;"
      Case "ϒ"
        coder = coder & "&upsih;"
      Case "ϖ"
        coder = coder & "&piv;"
      Case "•"
        coder = coder & "&bull;"
      Case "…"
        coder = coder & "&hellip;"
      Case "′"
        coder = coder & "&prime;"
      Case "″"
        coder = coder & "&Prime;"
      Case "‾"
        coder = coder & "&oline;"
      Case "⁄"
        coder = coder & "&frasl;"
      Case "℘"
        coder = coder & "&weierp;"
      Case "ℑ"
        coder = coder & "&image;"
      Case "ℜ"
        coder = coder & "&real;"
      Case "™"
        coder = coder & "&trade;"
      Case "ℵ"
        coder = coder & "&alefsym;"
      Case "←"
        coder = coder & "&larr;"
      Case "↑"
        coder = coder & "&uarr;"
      Case "→"
        coder = coder & "&rarr;"
      Case "↓"
        coder = coder & "&darr;"
      Case "↔"
        coder = coder & "&harr;"
      Case "↵"
        coder = coder & "&crarr;"
      Case "⇐"
        coder = coder & "&lArr;"
      Case "⇑"
        coder = coder & "&uArr;"
      Case "⇒"
        coder = coder & "&rArr;"
      Case "⇓"
        coder = coder & "&dArr;"
      Case "⇔"
        coder = coder & "&hArr;"
      Case "∀"
        coder = coder & "&forall;"
      Case "∂"
        coder = coder & "&part;"
      Case "∃"
        coder = coder & "&exist;"
      Case "∅"
        coder = coder & "&empty;"
      Case "∇"
        coder = coder & "&nabla;"
      Case "∈"
        coder = coder & "&isin;"
      Case "∉"
        coder = coder & "&notin;"
      Case "∋"
        coder = coder & "&ni;"
      Case "∏"
        coder = coder & "&prod;"
      Case "∑"
        coder = coder & "&sum;"
      Case "−"
        coder = coder & "&minus;"
      Case "∗"
        coder = coder & "&lowast;"
      Case "√"
        coder = coder & "&radic;"
      Case "∝"
        coder = coder & "&#8733;"
      Case "∞"
        coder = coder & "&infin;"
      Case "∠"
        coder = coder & "&ang;"
      Case "∧"
        coder = coder & "&and;"
      Case "∨"
        coder = coder & "&or;"
      Case "∩"
        coder = coder & "&cap;"
      Case "∪"
        coder = coder & "&cup;"
      Case "∫"
        coder = coder & "&int;"
      Case "∴"
        coder = coder & "&there4;"
      Case "∼"
        coder = coder & "&sim;"
      Case "≅"
        coder = coder & "&cong;"
      Case "≈"
        coder = coder & "&asymp;"
      Case "≠"
        coder = coder & "&ne;"
      Case "≡"
        coder = coder & "&equiv;"
      Case "≤"
        coder = coder & "&le;"
      Case "≥"
        coder = coder & "&ge;"
      Case "⊂"
        coder = coder & "&sub;"
      Case "⊃"
        coder = coder & "&sup;"
      Case "⊄"
        coder = coder & "&nsub;"
      Case "⊆"
        coder = coder & "&sube;"
      Case "⊇"
        coder = coder & "&supe;"
      Case "⊕"
        coder = coder & "&oplus;"
      Case "⊗"
        coder = coder & "&otimes;"
      Case "⊥"
        coder = coder & "&perp;"
      Case "⋅"
        coder = coder & "&sdot;"
      Case "⌈"
        coder = coder & "&lceil;"
      Case "⌉"
        coder = coder & "&rceil;"
      Case "⌊"
        coder = coder & "&lfloor;"
      Case "⌋"
        coder = coder & "&rfloor;"
      Case "◊"
        coder = coder & "&loz;"
      Case "♠"
        coder = coder & "&spades;"
      Case "♣"
        coder = coder & "&clubs;"
      Case "♥"
        coder = coder & "&hearts;"
      Case "♦"
        coder = coder & "&diams;"
      Case " "
        coder = coder & "&nbsp;"
      Case "¡"
        coder = coder & "&iexcl;"
      Case "¢"
        coder = coder & "&cent;"
      Case "£"
        coder = coder & "&pound;"
      Case "¤"
        coder = coder & "&curren;"
      Case "¥"
        coder = coder & "&yen;"
      Case "¦"
        coder = coder & "&brvbar;"
      Case "§"
        coder = coder & "&sect;"
      Case "¨"
        coder = coder & "&uml;"
      Case "©"
        coder = coder & "&copy;"
      Case "ª"
        coder = coder & "&ordf;"
      Case "«"
        coder = coder & "&laquo;"
      Case "¬"
        coder = coder & "&not;"
      Case "­"
        coder = coder & "&shy;"
      Case "®"
        coder = coder & "&reg;"
      Case "¯"
        coder = coder & "&macr;"
      Case "°"
        coder = coder & "&deg;"
      Case "±"
        coder = coder & "&plusmn;"
      Case "²"
        coder = coder & "&sup2;"
      Case "³"
        coder = coder & "&sup3;"
      Case "´"
        coder = coder & "&acute;"
      Case "µ"
        coder = coder & "&micro;"
      Case Else
        coder = coder & mid(Code, i, 1)
    End Select
    If i mod 10 = 0 Then
      strbld = strbld & coder
      coder = ""
    End If
  Next
  strbld = strbld & coder
  HtmlSafe = strbld
End Function

Public Function HtmlSafeE(html)
  Dim i
  Dim strbld
  Dim coder
  If IsNull(html) Then 
    coder = "" 
    Exit Function
  End If
  For i = 1 To Len(html)
    Select Case Mid(html, i, 1)
      Case """"
        coder = coder & "&quot;"
      Case "<"
        coder = coder & "&lt;"
      Case ">"
        coder = coder & "&gt;"
      Case "&"
        coder = coder & "&amp;"
      Case "'"
        coder = coder & "&apos;"
      Case Else
        coder = coder & mid(Code, i, 1)
    End Select
    If i mod 10 = 0 Then
      strbld = strbld & coder
      coder = ""
    End If
  Next
  strbld = strbld & coder
  HtmlSafeE = strbld
End Function
%>
